package xyz.xiaomeiqiu.study.domain;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@ConfigurationProperties(prefix = "xiaomeiqiu.school")
public class School {

    public School(){}

    public School(String schoolName, List<Klass> klasses){
        this.schoolName = schoolName;
        this.klasses = klasses;
    }

    private String schoolName;
    @Resource
    private List<Klass> klasses;

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public List<Klass> getKlasses() {
        return klasses;
    }

    public void setKlasses(List<Klass> klasses) {
        this.klasses = klasses;
    }


    public void ding(){
        System.out.println("学校有" + klasses.size() + "个班级: \r\n");
        for (Klass aClass : klasses) {
            System.out.println(aClass.toString());
        }

    }
}
